;zgpr_pulse.du
;avance-version (18/10/2022)
;1D sequence with signal presaturation using pulsed presat
;and optional 13C decoupling
;
;G. Peat, P.J. Boaler, C.L. Dickson, G.C. Lloyd-Jones & D. Uhrin, Nat. Commun., 2023 

;solvent suppression based on
;Kew, W., Bell, N.G.A. Goodall, I., Uhrin, D., Magn. Reson. Chem. 55, 785-796, (2017)

;For mutli-resonance suppression use Multi-reson-suppress.xlsx and PresatOptimise.jl to optimise p23 and o1

;$CLASS=HighRes
;$DIM=1D
;$TYPE=
;$SUBTYPE=
;$COMMENT=

#include <Avance.incl>
#include <Delay.incl>

"d12=20u"
"acqt0=-p1*2/3.1416"
"FACTOR1=(d1/(p23)) + 0.5"
"l6=FACTOR1"

1 ze

# ifdef C13_DEC
  d12 pl12:f2
# endif

2 30m

# ifdef C13_DEC
  d12 cpds2:f2
# endif

  d12 pl0:f1

3 (p23:sp23 ph29):f1
  2u
  lo to 3 times l6

# ifdef C13_DEC
  d12 do:f2
# endif

  d12 pl1:f1
  p1 ph1
  go=2 ph31
  30m mc #0 to 2 F0(zd)
exit


ph1=0 2 2 0 1 3 3 1
ph29=0
ph31=0 2 2 0 1 3 3 1

;DIGMOD = baseopt
;d1 : relaxation delay
;d12: delay for power switching                      [20 usec]
;ns: 1 * n, total number of scans: NS * TD0
;pl1 : f1 channel - power level for the p1 pulse 
;pl0 : f1 channel zero power level pldb0 1000
;p1 : f1 channel -  90 degree high power pulse

;p23 : ~50 ms low power rectangular pulse
;if off-resonance, calculate its exact length as desctiben in the Supplementary Information 

;if only one signal needs to be suppressed:
;SPNAM23 : Squa100.1000
;SPOFFS23 : resonance frequency of the suppressed signal minus o1 [Hz]
;spdb23 : use minimum power start with 60dB, asses the result

;if multiple signals need to be suppressed use Multi-reson-suppress.xlsx and PresatOptimise.jl to optimise p23 and o1
;create a phase-ramped shape using the calulated pulse length and the distances from o1
;prepare a rectangular shape and place it into the user library, e.g. Squa100.1000 (100us, 1000 points)
;on a topspin command line type:
;st manipulate /opt/topspin4.1/exp/stan/nmr/lists/wave/user/Squa100.1000 offs e 68936 3 565.73 -580.27 -754.27
;this will OVERWRITE the Squa100.1000 shape in /opt/topspin4.1/exp/stan/nmr/lists/wave/user/
;creating a 68936 us shape that will irradiate at 565.73, -580.27 and -754.27Hz away from optimised o1
;Note: for n frequencies replace 3 with n
;spdb23 : use minimum power, start with 60dB, asses the result. For every addtional frequency adjust by subtracting 6dB.

;if zgoptns -DC13_DEC:
;o2p : 13C chemical shift of the suppressed solvent signal
;pldb12 : power level for 13C decoupling
;at least 12dB weaker than the regular decoupler power
;pcpd2 : around 200us for selective decoupling
;cpdprg2 : xy32 or garp4

